//package com.mapper;
//
//import com.pojo.Department;
//import org.apache.ibatis.annotations.*;
//
//import java.util.List;
//
//@Mapper
//public interface DepartmentMapper {
//    // 新增部门（自动回填主键）
//    @Insert("INSERT INTO department (name, manager_id, parent_id, create_time) " +
//            "VALUES (#{name}, #{managerId}, #{parentId}, #{createTime})")
//    @Options(useGeneratedKeys = true, keyProperty = "id")
//    void insert(Department department);
//
//    // 查询所有部门（用于构建树形结构）
//    @Select("SELECT id, name, manager_id AS managerId, parent_id AS parentId, create_time AS createTime " +
//            "FROM department")
//    List<Department> selectAll();
//
//    // 根据ID查询部门详情
//    @Select("SELECT id, name, manager_id AS managerId, parent_id AS parentId, create_time AS createTime " +
//            "FROM department WHERE id = #{id}")
//    Department selectById(Integer id);
//
//    // 动态更新部门信息（只更新非空字段）
//    @Update("<script>" +
//            "UPDATE department " +
//            "<set>" +
//            "   <if test='name != null'>name = #{name},</if>" +
//            "   <if test='managerId != null'>manager_id = #{managerId},</if>" +
//            "   <if test='parentId != null'>parent_id = #{parentId},</if>" +
//            "</set>" +
//            "WHERE id = #{id}" +
//            "</script>")
//    void updateById(Department department);
//}